<%@ page contentType="text/html; charset=UTF-8"  %>
<!DOCTYPE html>
<html>
<head>
<title>接口注册</title>
    <%@ include file="/common/meta.jsp" %>
	<%@ include file="/common/import.jsp" %>
	<script type="text/javascript" src="${ctx}/js/zbxtools.js"></script>
	<script type="text/javascript" src="${ctx}/js/easyui/extendvalidate.js"></script>
<script type="text/javascript">
	var inputForm = '#inputForm';
	$(function(){
		$(inputForm).form({
		    success:function(data){
		    	var result = jQuery.parseJSON(data);
		    	if(result.flag=='T'){
		    		$.messager.confirm('提交结果', '操作成功', function(){
						parent.colseAdd();// 关闭添加窗口
		    			parent.cateReload();// 刷新列表
					});
		    	}else if(result.flag=='H'){
		    		$.messager.alert('提交结果', result.msg, 'info');
		    	}else{
		    		$.messager.alert('提交结果', '操作失败', 'error');
		    	}        
		    },
		    error:function(messg)  { 
	       	    $.messager.alert('错误提示', messg.responseText, 'error');
	       }  
		});
		$('#beanId').focus();
	});
	
	function doSubmit(){
		var flag = $(inputForm).form('validate');
		if(flag){
			//ZBXTools.showProcess('正在提交数据...');
			$(inputForm).submit();
		}
	}
</script>
</head>
<body>	

		<form id="inputForm" name="inputForm" method="post" action="${ctx}/protocol/save.action">
			<input type="hidden" name="formToken" id="formToken" value="${formToken}"/>
			<input type="hidden" name="registerId" id="registerId" value="${item.registerId}"/>
			<table class="datagrid-body">
			<tr>
				<td class="datagrid-header">beanID<font color=red>*</font></td>
				<td>
					<input id="beanId" name="beanId" value="${item.beanId}"
					class="easyui-validatebox" data-options="required:true" size="40"
					missingMessage="请输入beanID"  />
				</td>
			</tr>
			<tr>
				<td class="datagrid-header">bean名称</td>
				<td>
					<input id="beanName" name="beanName" value="${item.beanName}"
					class="easyui-validatebox"  size="40"
					missingMessage="请输入beanName"  />
				</td>
			</tr>
			<tr >
				<td class="datagrid-header">方法标识<font color=red>*</font></td>
				<td>
					<input name="methodName" id="methodName" value="${item.methodName}"
					class="easyui-validatebox" data-options="required:true,validType:'english'" size="40"
					missingMessage="请输入方法标识" invalidMessage="" />				
				</td>
			</tr>
			<tr >
				<td class="datagrid-header">协议<font color=red>*</font></td>
				<td>
				    <select name="callType" id="callType">
					   <option value="">--请选择--</option>
					   <option value="http">HTTP协议</option>
					   <option value="https">HTTPS协议</option>
					   <option value="socket">SOCKET协议</option>
					   <option value="webservice">WEBSERVICE协议</option>
					   <option value="internal">内部</option>
					</select>
				</td>
			</tr>
			<tr >
				<td class="datagrid-header">访问地址<font color=red>*</font></td>
				<td>
					<input name="address" id="address" value="${item.address}"
					class="easyui-validatebox" data-options="required:false" size="40"
					missingMessage="请输入访问地址" invalidMessage="" />				
				</td>
			</tr>
			<tr>
				<td class="datagrid-header">端口</td>
				<td>
					<input id="port" name="port"  value="${item.port}"
					class="easyui-validatebox" data-options="required:false" size="40" />
				</td>
			</tr>			
			<tr>
				<td class="datagrid-header">状态<font color=red>*</font></td>
				<td>
					<input type="radio" name="flag" id="flag_1" value="1" checked="checked"/>启用
					<input type="radio" name="flag"  id="flag_0" value="0" />停用
				</td>
			</tr>
				
			<tr>
				<td class="datagrid-header"></td>
				<td >	
					<a href="#" class="easyui-linkbutton" id="bt1" iconCls="icon-save" onclick="doSubmit();">提交</a>
					<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="parent.colseAdd();"; >取消</a>	
				</td>
			</tr>
			</table>
		</form>
</body>
</html>
<script>
	ZBXTools.initRadio("flag","${item.flag}");
	ZBXTools.initSelect("callType","${item.callType}");
</script>